﻿@model MvcCmsProjectTracker.ViewModels.TicketCommentViewModel
<div id="comments">
    @if (Model.TicketComments.Count > 0)
    {
        foreach (var item in Model.TicketComments)
        { 
            <div>
               <b>@string.Format("{0} - {1} ", item.UserName, item.DateCreated) </b>
                @if (Roles.IsUserInRole("Admin") || Roles.IsUserInRole("HelpDeskAdmin"))
                {
                    @Ajax.ActionLink("Delete", "DeleteComment", new { id = item.CommentID }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "comments", OnFailure = "handleFailure", Confirm = "Are you sure you want to delete this comment?", OnSuccess = "styleControls" });
                }
            </div>
        <div>
            @item.Comment
        </div>
        <hr />
        }
    }
    @Html.Partial("ControlsProjectTracker/Message", Model)
</div>
